package com.tourex;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;

public class ActivityCollector {

	public static List<Activity> activities = new ArrayList<Activity>();

	public static void addActivity(Activity activity) {
		if (!activities.contains(activity)) {
			activities.add(activity);
		}
	}

	public static void removeActivity(Activity activity) {
		activities.remove(activity);
	}

	public static int size() {
		return activities.size();
	}

	public static void finishAll() {
		for (Activity activity : activities) {
			if (!activity.isFinishing())
				activity.finish();
		}
		System.exit(0);
	}
}
